/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package coalescent.cef.pui;

import cef.event.EstimateModelEvent;
import cef.event.Event;
import cef.pui.EventConstructionException;
import cef.pui.EventImpl;
import cef.pui.pob.Builder;
import cef.pui.pob.BuilderException;
import coalescent.cef.pui.pob.Builders_Coa;
import coalescent.data.K69Data;
import coalescent.model.K69;
import commons.core.ModelEstimator;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/**
 * Properties.
 * <ul>
 *    <li>{@code coalescent.builder.K69Data.url = k69data:xml//URL }<a href="coalescent/cef/pui/pob/doc-files/k69data.xml.txt">file format</a>, must accompany the <a href="coalescent/cef/pui/pob/doc-files/k69data.xsd.txt">schema</a></li>
 *    <li>{@code coalescent.builder.K69Estimator.implCode = watterson}</li>
 * </ul>
 *
 * @author Susanta Tewari
 * @version 1.0.0
 * @history Created on 03/27/2013
 * @since 1.0.0
 */
public final class EstimateModelK69EventImpl extends EventImpl
        implements EstimateModelEvent<K69, K69Data> {

    private final Builder<ModelEstimator<K69, K69Data, K69Data, ?>> estimatorBuilder;

    public EstimateModelK69EventImpl(final Properties props) throws EventConstructionException {

        super(props);

        super.processEventProperties(getImplementedEventInterfaces());

        estimatorBuilder = Builders_Coa.of_ModelEstimator_K69(props, null);
    }

    @Override
    protected List<Class<? extends Event>> getImplementedEventInterfaces() {

        final List<Class<? extends Event>> result = new ArrayList<>(2);

        result.add(EstimateModelEvent.class);
        result.add(Event.class);

        return result;
    }

    @Override
    public ModelEstimator<K69, K69Data, K69Data, ?> getEstimator() throws BuilderException {
        return estimatorBuilder.build();
    }
}
